package com.example.mqttmanage.domain.base;

/**
 * 返回状态码枚举类
 */
public enum Status {
    SUCCESS(200, "success"),
    ERROR(500, "error"),
    UNAUTHORIZED(401, "unauthorized"),
    FORBIDDEN(403, "forbidden"),
    NOT_FOUND(404, "not found"),
    METHOD_NOT_ALLOWED(405, "method not allowed"),
    REQUEST_TIMEOUT(408, "request timeout"),
    TOO_MANY_REQUESTS(429, "too many requests"),
    INTERNAL_SERVER_ERROR(500, "internal server error");

    private final int code;
    private final String description;

    Status(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 静态常量定义
    public static final int SUCCESS_CODE = 200;
    public static final int ERROR_CODE = 500;
    public static final int UNAUTHORIZED_CODE = 401;
    public static final int FORBIDDEN_CODE = 403;
    public static final int NOT_FOUND_CODE = 404;
    public static final int METHOD_NOT_ALLOWED_CODE = 405;
    public static final int REQUEST_TIMEOUT_CODE = 408;
    public static final int TOO_MANY_REQUESTS_CODE = 429;
    public static final int INTERNAL_SERVER_ERROR_CODE = 500;

}
